<?php foreach ($search_params as $search_k => $searchs): ?>
    <?php if ($search_k == 1): ?>
        <div class="collapse" id="collapseExample">
    <?php endif ?>
    
    <div class="row" style="margin-bottom: 10px;">
    <?php foreach ($searchs as $vo): ?>
        <?php $field = $vo['key']; ?>
        <?php $value = emptyDef($vo['value'],input($field),'isset'); ?>

        <?php if ($vo['type'] == 'text'): ?>
        <div class="col-md-2">
            <div class="input-group">
                <span class="input-group-btn"><button class="btn btn-default" type="button">{:$vo['name']}</button></span>
                <input type="text" class="form-control" name="{:$field}" placeholder="{:$vo['placeholder']}" value="{:$value}">
            </div>
        </div>
        <?php elseif (in_array($vo['type'], ['select1','select1_1'])): ?>
        <div class="col-md-2">
            <div class="input-group">
                <span class="input-group-btn"><button class="btn btn-default" type="button">{:$vo['name']}</button></span>
                <select class="form-select" id="{:$field}" name="{:$field}">
                    <?php if ($vo['type'] == 'select1_1'): ?>
                        <option value="">全部</option>
                    <?php endif; ?>
                    <?php foreach ($vo['params'] as $param_k => $param_v): ?>
                        <option value="{:$param_k}" {:$value != null && $param_k==$value?'selected':''}>{:$param_v}</option>
                    <?php endforeach ?>
                </select>
            </div>
        </div>
        <?php elseif ($vo['type'] == 'date'): ?>
        <div class="col-md-2">
            <div class="input-group">
                <span class="input-group-btn"><button class="btn btn-default" type="button">{:$vo['name']}</button></span>
                <input type="text" class="form-control" data-provide="datepicker" data-autoclose="true" id="{:$field}" name="{:$field}" value="{:$value}" placeholder="{:$vo['placeholder']}" />
            </div>
        </div>
        <?php elseif ($vo['type'] == 'keyword'): ?>
        <div class="col-md-2">
            <div class="input-group">
                <span class="input-group-btn" style="max-width: 110px;">
                    <select class="form-control selectpicker" multiple id="{:$field}" placeholder="{:$vo['name']}">
                        <?php $valarray = explode('|',$value); ?>
                        <?php foreach ($vo['params'] as $param_k => $param_v): ?>
                            <option value="{:$param_k}" {:in_array($param_k,$valarray) || (empty($value) && $param_k == $vo['default'])?'selected':''}>{:$param_v}</option>
                        <?php endforeach ?>
                    </select>
                    <input type="hidden" name="{:$field}" value="{:$value}" />
                </span>
                <input type="text" class="form-control" name="{:$field}_txt" placeholder="{:$vo['placeholder']}" value="{:input($field.'_txt')}">
            </div>
        </div>

        
        <?php elseif (in_array($vo['type'], ['select2','select2_1'])): ?>
        <div class="col-lg-3">
            <div class="input-group">
                <span class="input-group-btn"><button class="btn btn-default" type="button">{:$vo['name']}</button></span>
                <select class="js-select2 form-control" id="{:$field}" name="{:$field}">
                    <?php if ($vo['type'] == 'select2_1'): ?>
                        <option value="">全部</option>
                    <?php endif; ?>
                    <?php foreach ($vo['params'] as $param_k => $param_v): ?>
                        <option value="{:$param_k}" {:$value != null && $param_k==$value?'selected':''}>{:$param_v}</option>
                    <?php endforeach ?>
                </select>
            </div>
        </div>
        <?php elseif ($vo['type'] == 'textarea'): ?>
            <label class="col-lg-1 control-label" for="{:$field}">{:$vo['name']}</label>
            <div class="col-lg-2">
                <textarea class="form-control" id="{:$field}" name="{:$field}" rows="4" placeholder="{:$vo['placeholder']}">{:$value}</textarea>
            </div>
        <?php elseif ($vo['type'] == 'file'): ?>
            <label class="col-lg-1 control-label">{:$vo['name']}</label>
            <div class="col-md-6">
                <div id="{:$field}" class="uploader_btn">选择文件</div>
                <span class="uploader_span"></span>
                <input class="form-control" type="hidden" name="{:$field}" value="{:$value}" />
            </div>
            <label class="col-lg-2 text-right"><img src="__UPLOAD__/{:$value}" class="cch_thumbnail"></label>
        <?php elseif ($vo['type'] == 'files'): ?>
            <label class="col-lg-1 control-label">{:$vo['name']}</label>
            <div class="col-md-6">
                <div id="{:$field}" class="uploader_btns">选择文件</div>
            </div>
            <div class="uploader_more_div">
                <label class="col-lg-1 control-label"></label>
                <div class="col-md-6">
                    <?php if (!empty($value)): ?>
                        <?php $images = explode(',', $value); ?>
                        <?php foreach ($images as $image): ?>
                            <div class="item">
                                <p><img src="__UPLOAD__/{:$image}" class="cch_thumbnail"></p>
                                <input type="hidden" name="{:$field}[]" value="{:$image}" />
                                <button type="button" class="btn btn-xs btn-danger" onclick="uploader_del(this)">删除</button>
                            </div>
                        <?php endforeach ?>
                    <?php endif ?>
                </div>
            </div>
        <?php elseif ($vo['type'] == 'ueditor'): ?>
            <label class="col-lg-1 control-label" for="{:$field}">{:$vo['name']}</label>
            <div class="col-lg-2">
                <textarea id="{:$field}" class="ueditor" name="{:$field}" placeholder="{:$vo['placeholder']}">{:$value}</textarea>
            </div>
        <?php elseif ($vo['type'] == 'checkbox'): ?>
            <label class="col-lg-1 control-label" for="{:$field}">{:$vo['name']}</label>
            <div class="col-lg-2">
                <?php foreach ($vo['params'] as $param_k => $param_v): ?>
                    <label class="checkbox-inline" for="{:$field.'_'.$param_k}">
                        <input type="checkbox" id="{:$field.'_'.$param_k}" name="{:$field}[]" value="{:$param_k}" /> {:$param_v}
                    </label>
                <?php endforeach ?>
            </div>
        <?php elseif ($vo['type'] == 'tags'): ?>
            <label class="col-lg-1 control-label" for="{:$field}">{:$vo['name']}</label>
            <div class="col-lg-2">
                <input class="js-tags-input form-control" type="text" id="{:$field}" name="{:$field}" value="{:$value}" />
            </div>
        <?php elseif ($vo['type'] == 'datetime'): ?>
        <div class="col-lg-3">
            <div class="input-group">
                <span class="input-group-btn"><button class="btn btn-default" type="button">{:$vo['name']}</button></span>
                <input class="js-datetimepicker form-control" autocomplete="off" id="{:$field}" name="{:$field}" placeholder="{:$vo['placeholder']}" value="{:$value}" data-locale="zh-cn" data-format="YYYY-MM-DD HH:mm"  data-side-by-side="true"/>
            </div>
        </div>
        
        <?php elseif ($vo['type'] == 'time'): ?>
            <label class="col-lg-1 control-label" for="{:$field}">{:$vo['name']}</label>
            <div class="col-lg-2">
                <input class="js-datetimepicker form-control" autocomplete="off" id="{:$field}" name="{:$field}" placeholder="{:$vo['placeholder']}" value="{:$value}" data-locale="zh-cn" data-format="HH:mm" />
            </div>
        <?php endif; ?>
    <?php endforeach; ?>

    <?php if ($search_k == 0): ?>
        <div class="col-md-2">
            <a class="btn btn-primary" data-bs-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample"><i class="mdi mdi-chevron-down"></i> 更多</a>
        </div>
    <?php endif ?>
    
    </div>

    <?php if ($search_k == count($search_params)-1): ?>
        </div>
    <?php endif ?>
    
<?php endforeach ?>
